//
//  UpLoadData.m
//  EarnBao
//
//  Created by xiaohui on 15/4/24.
//  Copyright (c) 2015年 杭州赚宝科技有限公司. All rights reserved.
//

#import "UpLoadData.h"
#import "AFNetworking.h"

@implementation UpLoadData

//声明一个静态对象成为单例
static UpLoadData *handle = nil;

//实现单例的类方法，全局只有一个单例对象
+ (UpLoadData *)shareDataHandle
{
    if (handle == nil) {
        
        handle = [[UpLoadData alloc] init];
    }
    return handle;
}

//数据的上传
- (void)upLoadDataWithURL:(NSString *)urlString
{
    //获取app版本号
    NSDictionary *inforDic = [[NSBundle mainBundle] infoDictionary];
    NSString *app_version = inforDic[@"CFBundleShortVersionString"];
    
    //初始化将要上传到服务器的的数据字典
    NSDictionary *parameters = @{@"app_version": app_version};
    
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    
    [manager GET:urlString parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        //NSLog(@"%@",responseObject);
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        //NSLog(@"%@",error);
    }];
}

@end
